package com.example.mystore.mapper;

import com.example.mystore.model.Product;
import com.example.mystore.model.ProductCategory;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserProductCategoryMapper {

    @Select("SELECT * FROM type WHERE level = 0 AND status = 1")
    List<ProductCategory> getSpecificCategories();

    @Select("SELECT * FROM type ORDER BY level, sort_order")
    List<ProductCategory> findAllCategories();
    @Select("SELECT * FROM commodity WHERE parts_id = #{typeId}")
    List<Product> findProductsByTypeId(@Param("typeId") int typeId);
}
